Skip to content

test: migrate stats/base/dists/discrete-uniform/stdev to ULP-based assertions - #14337

Merged
kgryte merged 1 commit into
developfrom
claude/beautiful-babbage-27t8sv
Aug 16, 2026
Merged

test: migrate stats/base/dists/discrete-uniform/stdev to ULP-based assertions#14337
kgryte merged 1 commit into
developfrom
claude/beautiful-babbage-27t8sv

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

Changes are confined to the package's test files (test/test.js, test/test.native.js):

  • adds the @stdlib/assert/is-almost-same-value require and removes the now unused @stdlib/math/base/special/abs and @stdlib/constants/float64/eps requires.
  • removes the delta/tol declarations and the if ( y === expected[i] ) { ... } else { ... } tolerance branch.
  • replaces the fixture-loop assertion with t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );.

No implementation, fixture, or documentation files are touched, and no test cases were added, removed, or otherwise altered.

ULP bound

The converted assertion loop uses an ULP value of 1, which is the measured minimum.

The bound was measured rather than guessed: computing the exact ULP difference (via @stdlib/number/float64/base/ulp-difference) between the computed value and the expected fixture value for all 1000 fixtures (test/fixtures/julia/data.json) yields a maximum observed ULP difference of 1.

Verification:

  • test/test.js — 1008 assertions (1000 fixture comparisons + 8 edge-case assertions), all passing at ULP bound 1.
  • The full suite was run twice at the final ULP value with identical results, to confirm the bound is not sensitive to FMA/architecture-dependent rounding.
  • test/test.native.js was updated identically for consistency with the JS implementation's idiom; the native add-on was not compiled in this environment, so those assertions are skipped (as they were prior to this change, since lib/native.js is not built by default).
  • ESLint reports no problems for the two changed files.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Opened as a draft.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This PR was authored by Claude Code running as an unattended scheduled task. It studied the issue and previously merged ULP migrations in the same package family (notably the sibling package stats/base/dists/discrete-uniform/cdf, #14311) to match the established idiom, applied the mechanical test conversion, and empirically measured the minimum ULP bound before verifying the test suite.


@stdlib-js/reviewers


Generated by Claude Code

…assertions

Replaces the EPS-derived tolerance check with `isAlmostSameValue`,
tightened to a maximum ULP difference of 1 measured against the full
fixture set.

Ref: #11352

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: skipped
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Good First PR A pull request resolving a Good First Issue. labels Aug 16, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/discrete-uniform/stdev $\\color{green}185/185$
$\\color{green}+100.00\\%$
$\\color{green}9/9$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}185/185$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 16, 2026
@kgryte
kgryte marked this pull request as ready for review August 16, 2026 22:30
@kgryte
kgryte requested a review from a team August 16, 2026 22:30
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 16, 2026
@kgryte
kgryte merged commit 7d941af into develop Aug 16, 2026
82 checks passed
@kgryte
kgryte deleted the claude/beautiful-babbage-27t8sv branch August 16, 2026 22:31
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants